/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var map;
var markersArray = [];
function init(){
    var mapOptions = {
        center: new google.maps.LatLng(40.646978,-8.647885),
        zoom: 14,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"),
        mapOptions);     
}
function shopMarker(lat,lng){
    var image = 'SshopingIcon.bmp';
    
    marker = new google.maps.Marker({
        position: new google.maps.LatLng(lat,lng),
        map:map
    });
    return marker;
}
function addMaker(lat,lng){
    clearOverlays();
    marker= shopMarker(lat, lng);
       
    markersArray.push(marker);
    marker.setMap(map);
    map.setCenter(new google.maps.LatLng(lat,lng));
}
function showOverlays() {
    if (markersArray) {
        for (i in markersArray) {
            markersArray[i].setMap(map);
        }
    }
}
function clearOverlays() {
    if (markersArray) {
        for (i in markersArray) {
            markersArray[i].setMap(null);
        }
    }
}

function deleteOverlays() {
    if (markersArray) {
        for (i in markersArray) {
            markersArray[i].setMap(null);
        }
        markersArray.length = 0;
    }
}

 